'''
Author: your name
Date: 2021-03-23 09:58:36
LastEditTime: 2021-03-23 11:04:10
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath: /tinyms/tinyms-api/apps/auth/role/model.py
'''
from app import app,db,auth
from datetime import datetime

class Role(db.Model):
    #定义字段和数据库建立映射关系
    __tablename__ = 'sys_role'
    role_pk = db.Column(db.Integer,primary_key=True,autoincrement=True,)
    role_name = db.Column(db.String)
    role_time = db.Column(db.String)
    role_status = db.Column(db.String)
    role_remark = db.Column(db.String)

    def __repr__(self):
        return '<Role %r>' % self.role_pk


    def list_to_dict(items):
        lic = []
        for item in items:
            lic.append(
                        {
                            'role_pk':item.role_pk,
                            'role_name' : item.role_name,
                            'role_time' : item.role_time,
                            'role_status' : item.role_status,
                            'role_remark' : item.role_remark,
                        }
                    )
        return lic